package com.heu.blood.transfusion.controller;

import java.util.Arrays;
import java.util.Map;

import com.heu.blood.common.aop.ControllerLogAnnotation;
import com.heu.blood.dict.service.DictDataService;
import com.heu.blood.dict.service.DictDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.heu.blood.transfusion.entity.PatientFeesEntity;
import com.heu.blood.transfusion.service.PatientFeesService;
import com.heu.blood.common.utils.PageUtils;
import com.heu.blood.common.utils.R;



/**
 * 
 *
 * @author myq
 * @email 596921409@qq.com
 * @date 2023-08-28 08:36:06
 */
// 听师姐说这个表不用了
@RestController
@RequestMapping("transfusion/patientfees")
public class PatientFeesController {
    @Autowired
    private PatientFeesService patientFeesService;
    @Autowired
    private DictDataService dictDataService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @ControllerLogAnnotation(module = "病人收费", operate = "分页查询病人费用信息")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = patientFeesService.queryPage(params);


        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @ControllerLogAnnotation(module = "病人收费", operate = "根据id查询病人收费信息")
    public R info(@PathVariable("id") Long id){
		PatientFeesEntity patientFees = patientFeesService.getById(id);

        return R.ok().put("patientFees", patientFees);
    }

    /**
     * 保存
     * 项目金额ProjectAmount由单价*数量相乘保留两位小数获得
     */
    @RequestMapping("/save")
    @ControllerLogAnnotation(module = "病人收费", operate = "保存病人收费信息")
    public R save(@RequestBody PatientFeesEntity patientFees){


		String msg = patientFeesService.savePatientFees(patientFees);

        return R.ok(msg);
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @ControllerLogAnnotation(module = "病人收费", operate = "修改病人收费信息")
    public R update(@RequestBody PatientFeesEntity patientFees){
		patientFeesService.updateById(patientFees);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @ControllerLogAnnotation(module = "病人收费", operate = "批量删除病人收费信息")
    public R delete(@RequestBody Long[] ids){
		patientFeesService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
